<%@ page import="java.time.LocalDateTime"%>
<%@ page import="blog.entities.User"%>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录成功</title>
   <meta charset="UTF-8">
    <!--    为了确保适当的绘制和触屏缩放，需要在 <head> 之中添加 viewport 元数据标签。-->
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

<!--     jQuery文件。务必在bootstrap.min.js 之前引入
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> -->

<script
  src="https://code.jquery.com/jquery-3.4.1.js"
  integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
  crossorigin="anonymous"></script>

   <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script>



	$(function(){
		setInterval(function() {

<%-- 			<%
				String timeStr = "";
		        LocalDateTime time = LocalDateTime.now();
		        int year = time.getYear();
		        int month = time.getMonthValue();
		        int day = time.getDayOfMonth();
		        int hour = time.getHour();
		        int minute = time.getMinute();
		        int second = time.getSecond();
		        timeStr = year + "-" + month + "-" + day + " " + hour + ":"
		                + minute + ":" + second;
			%> --%>
			$("#time").html(new Date().toLocaleString());
		}, 1000);
		
		
	});
</script>
</head>
<body>
<div class="container">
<%
	Object obj = session.getAttribute("user");
	ArrayList<User> userList = null;
	User user = null;
	if (obj!=null) {
		user = (User)obj;
	}
	obj = session.getAttribute("allUser");
	if (obj!=null) {
		userList = (ArrayList<User>)obj;
	}
%>
<!-- 需要显示当前登录人信息 -->
<%
	if (user!=null) {
		session.setAttribute("loginedUsername", user.getUsername());
	}
%>
	<h2>欢迎<%=user.getUsername() %>使用本站!</h2>
	
	<h2>当前时间为<i id="time"></i></h2>
<!-- 需要显示客户列表数据 -->
	<div class="btn-group">
		<button type="button" class="btn btn-primary" id="refresh_curPage">刷新本页</button>
		<a type="button" class="btn btn-primary" id="go_mgrCenter">前往成员管理中心</a>
	</div>

</div>

<script>
	var flag = true;
	$(".user_selection_list").prop("checked",false);
	/* 全选 */
	$("#all_selection").on("click",function(){
		if (flag === true) {
			flag = !flag;
			$(".user_selection_list").prop("checked",true);
		} else {
			flag = !flag;
			$(".user_selection_list").prop("checked",false);
		}
	});
	
	/* 反选 */
	$("#inverted_selection").on("click",function(){
		$(".user_selection_list").each(function(){
			$(this).prop("checked",!($(this).prop("checked")));			
		});
	});
	
	function confirmDeleteUser(id) {
		if(confirm("请确认是否删除?")) {
			location.href = "<%=request.getContextPath() %>/mgrCenter?option=deleteUser&id=" + id;
		} else {
			
		}
		
	}
	
	/* 刷新本页面 */
	$("#refresh_curPage").click(function(){
		location.reload();
	});
	
	/* 前往成员管理中心 */
	$("#go_mgrCenter").on("click",function(){
		window.location.href = "<%=request.getContextPath() %>/mgrCenter?option=mgrCenter"; 
	});
</script>
</body>
</html>